<template>
  <div>      
      <el-table :data="dataList" border >
        <el-table-column label="序号" type="index"></el-table-column>
        <el-table-column label="值" prop="spec_value"></el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button type="primary" @click="choose(scope.row)">选择</el-button>            
          </template>
        </el-table-column>
      </el-table>         
  </div>
</template>

<script>
import {allval,removeVal} from "@/api/shop/spec.js"

  export default {
    props:[
      'specId'
    ],
    watch:{
      specId:{
        handler:function(val){
          console.log("specId",val);
          this.query.id = val;
          this.getData();
        },
        immediate:true,
      }
    },
    data(){
      return {
        query:{
          id:'',
        },
        dataList:[],    
      }
    },
    created(){
      this.getData();
    },
    methods:{
      getData(){
        allval(this.query.id).then(res=>{          
          this.dataList = res;
        })
      },     
      choose(row){
        this.$emit("choose",row);
      }
    }
  }
</script>

<style scoped>

</style>